package com.zqj.project.factory;

import com.zqj.project.common.database.mybatis.conditions.Wraps;
import com.zqj.project.common.database.mybatis.conditions.query.LbqWrapper;
import com.zqj.project.entity.UserPO;
import com.zqj.project.model.User;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @Description: UserFactory
 * @Author: 22001010704 Zhang Qijian
 * @CreateTime: 2024/12/8 18:53
 * @Version: 1.0
 */
public class UserFactory {

    private UserFactory() {
        throw new IllegalStateException("Utility Class");
    }

    public static LbqWrapper<UserPO> lbqWrapper(User user) {
        return Wraps.<UserPO>lbQ().like(StringUtils.isNotBlank(user.getName()), UserPO::getName, user.getName()).like(Objects.nonNull(user.getTel()), UserPO::getTel, user.getTel());
    }

}